package com.itemdoc.organ.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * OSS配置文件
 */
@Component
public class OssConfig implements InitializingBean {
	/**
	 * ossHost Endpoint以北京为例，其它Region请按实际情况填写
	 */
	@Value("${aliyun.ossHost}")
	private String aliyun_endpoint;
	/**
	 * 阿里云主账号AccessKey AccessKeyId
	 */
	@Value("${aliyun.ossAccount}")
	private String aliyun_keyid;
	/**
	 * 阿里云主账号AccessKey AccessKeySecret
	 */
	@Value("${aliyun.ossPassword}")
	private String aliyun_keysecret;
	/**
	 * BucketNam
	 */
	@Value("${aliyun.ossBucket}")
	private String aliyun_bucketname;

	@Value("${aliyun.filehost}")
	private String aliyun_filehost;
	/**
	 * ossFolder 后面必须加上 ‘/’dev/
	 */
	@Value("${aliyun.ossFolder}")
	public static String aliyun_ossFolder;
	
	@Value("${aliyun.ossHostInternal}")
	public static String aliyun_ossHostInternal;
	
	public static String ALIYUN_OSS_HOSTINTERNAL;
	
	public static String ALIYUN_OSS_FOlDER;
	
	public static String ALIYUN_END_POINT;
	
	public static String ALIYUN_ACCESS_KEY_ID;
	
	public static String ALIYUN_ACCESS_KEY_SECRET;
	
	public static String ALIYUN_BUCKET_NAME;
	
	public static String ALIYUN_FILE_HOST;

	@Override
	public void afterPropertiesSet() throws Exception {
		ALIYUN_OSS_HOSTINTERNAL=aliyun_ossHostInternal;
		ALIYUN_OSS_FOlDER=aliyun_ossFolder;
		ALIYUN_END_POINT = aliyun_endpoint;
		ALIYUN_ACCESS_KEY_ID = aliyun_keyid;
		ALIYUN_ACCESS_KEY_SECRET = aliyun_keysecret;
		ALIYUN_BUCKET_NAME = aliyun_bucketname;
		ALIYUN_FILE_HOST = aliyun_filehost;
	}
}
